#!/usr/bin/env python
# -*- coding: utf-8 -*-

from BeautifulSoup import BeautifulSoup # To get everything
import urllib2

#print sys.argv
#import SimpleHTTPServer
#import SocketServer
#PORT = 8080
#Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
#httpd = SocketServer.TCPServer(("", PORT), Handler)
#print "serving at port", PORT

def findTags(url):
    page = urllib2.urlopen(url)
    soup = BeautifulSoup(page)
    lista = ["h1", "h2", "h3", "div", "p", "ul", "ol"]
    for tag in lista:
        print '{0} = {1}\n'.format(tag, len(soup.findAll(tag)))
    pass
pass

findTags("http://www.correioalentejo.com");                  
#httpd.serve_forever()

